package org.dromara.school.service.impl;

import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.dromara.school.domain.bo.StudentParentBo;
import org.dromara.school.domain.vo.StudentParentVo;
import org.dromara.school.domain.StudentParent;
import org.dromara.school.mapper.StudentParentMapper;
import org.dromara.school.service.IStudentParentService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import java.util.List;
import java.util.Map;
import java.util.Collection;

/**
 * 学生家长信息Service业务层处理
 *
 * @author Gjb
 * @date 2025-06-17
 */
@RequiredArgsConstructor
@Service
public class StudentParentServiceImpl  extends MPJBaseServiceImpl<StudentParentMapper,StudentParent> implements IStudentParentService {

    private final StudentParentMapper baseMapper;


    @Override
    public List<StudentParent> findStudentParentByStudentId(Long studentId) {
        LambdaQueryWrapper<StudentParent> wrapper = new LambdaQueryWrapper();
        wrapper.eq(StringUtils.isNotNull(studentId), StudentParent::getStudentId,studentId);
        return  this.baseMapper.selectList(wrapper);
    }

    @Override
    public int deleteByStudentId(Long studentId) {
        LambdaQueryWrapper<StudentParent> wrapper = new LambdaQueryWrapper();
        wrapper.eq(StringUtils.isNotNull(studentId), StudentParent::getStudentId,studentId);
        return this.baseMapper.delete(wrapper);
    }
}
